<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
[#include "/admin/include/head.htm"]

    <script type="text/javascript">


        var grid;
        function review_loan(){
            var selecteds = grid.getSelecteds();
            if (selecteds.length != 1) {
                LG.tip('请选择一行记录!');
                return;
            }
            top.f_addTab(null, '满标审核', ' /admin/borrow/toVerify.aspx?borrowId='+selecteds[0].id);
        }
        function cancel_loan(){
            var selecteds = grid.getSelecteds();
            if (selecteds.length != 1) {
                LG.tip('请选择一行记录!');
                return;
            }else{

                jQuery.ligerDialog.confirm('确定取消吗吗?', function (confirm) {
                    if (confirm){
                        LG.ajax({

                            url : base+'/admin/borrow/full_cancel.aspx',
                            loading: '正在取消中...',
                            data: { LoanId: selecteds[0].id },
                            success: function () {
                                LG.showSuccess('操作成功!');
                                f_reload();
                            },
                            error: function (message) {
                                LG.showError(message);
                            }
                        });
                    }
                });
            }

        }
        $(function(){
            grid = $("#maingrid").ligerGrid({
                columns: [
                    {hide: true, name: 'path'},
                    {display: '标的类型', name: 'category_name', align: 'center', width: 200 },
                    {display: '项目名称', name: 'name', align: 'center', width: 100 },
                    {display: '用户名', name: 'u_user_name', align: 'center', width: 100 },
                    {display: '标的id', name: 'id', align: 'center', width: 120 },
                    {display: '筹款金额', name: 'account', align: 'center', width: 100 },
                    {display: '月份', name: 'time_limit', align: 'center', frozen: true },
                    {display: '借款期限', name: 'is_day', align: 'center', width: 100,
                        render: function(row){
                            return row.time_limit + (row.is_day == "0" ? '月' : '天');
                        }
                    },
                    {display: '年化', name: 'apr', align: 'center', width: 100 },
                    {display: '满标时间', name: 'full_verify_time', align: 'center', width: 100 ,
                        render: function(row){
                            return timetrans(row.full_verify_time) ;
                        }
                    },
                    {display: '还款方式', name: 'pay_style', align: 'center', width: 100,dict:'borrow_style' },
                    {display: '待还金额', name: 'repayment_account', align: 'center', width: 100 },
                    {display: '已还金额', name: 'repayment_yesaccount', align: 'center', width: 100 },

                    {display: '支持体验红包', name: 'red_packet_status', align: 'center', width: 100 ,dict:'red_packet_status'},

                    {display: '奖励', name: 'radio_account', align: 'center', width: 100 }

                ],  pageSize:20, url: 'queryData.aspx?status=5',toolbar: {}, width: '100%', height:'100%', enabledSort: true
            });


            $(".l-toolbar").ligerToolBar({ items: [

                { text: '投标记录', click: f_tenderlog },

                { line:true },
                { text: '还款明细', click: f_repay_detail }
                , { line:true },
                { text: '导出', click: f_export_loan },
            ]
            });
            //绑定搜索按钮
            LG.search(grid);
        });
        function f_repay_detail(){

            var selecteds = grid.getSelecteds();
            if (selecteds.length != 1) {
                LG.tip('请选择一行记录!');
                return;
            }
            top.f_addTab(null, '投标记录', '/admin/repayment/list.aspx?borrowId='+selecteds[0].id);

        }




        function f_tenderlog(){
            var selecteds = grid.getSelecteds();
            if (selecteds.length != 1) {
                LG.tip('请选择一行记录!');
                return;
            }
            top.f_addTab(null, '投标记录', '${path}/admin/tender/tenderLog'+selecteds[0].id+'.aspx');

        }


        function f_export_loan(){
            window.location.href="${path}/admin/borrow/exportBorrowList.aspx?status=5";
        }


    </script>
</head>
<body style="padding:10px; overflow:hidden;">
<div id="functions">
    <div class="clearfix">
        <div style="float:left;">
				<span>
					类型： [@u.select listKey="id"  headerKey="" headerValue="全部类型" listValue="category_name" headerButtom="false" list=LoanCategoryUtils.getLoanCategoryList()
                name="loanCategory" value="${(loanCategory)!''}" /]
				</span>
				<span>
					用户名：<input type="text" name="memberName"  />
				</span>

            申请时间：<input type="text" id="begin_date" name="begin_date"
                        class="formText WdatePicker {dateFmt:'yyyy-MM-dd'}" />
            -
            <input type="text" id="endDate" name="end_date"
                   class="formText WdatePicker {dateFmt:'yyyy-MM-dd'}" />
            <input type="button" class="button" value="搜索" id="search"/>
            <a href="#" id="search_btn_reset" face="Wingdings 3">清除本次搜索</a>
        </div>
    </div>
</div>

<div id="maingrid" style="margin:0; padding:0"></div>
</body>
</html>